<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>查看所有日志</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8"/>
    <link rel="stylesheet" href="/static/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/x-admin/xadmin.css">
</head>
<body class="layui-anim layui-anim-scale">
<div class="x-body">
    <div class="layui-field-box">
        <div class="layui-row">
            <form class="layui-form layui-col-md12 x-so" action="/admin/logs/showLogs" method="post">
                <input class="layui-input" autocomplete="off" placeholder="开始日" name="startTime" id="start" lay-key="1">
                <input class="layui-input" autocomplete="off" placeholder="截止日" name="endTime" id="end" lay-key="2">
                <button type="submit" class="layui-btn" lay-submit lay-filter="sreach"><i
                        class="layui-icon layui-icon-search"></i>
                </button>
            </form>
            <button type="button" class="layui-btn layui-btn-danger" onclick="removeLogs()">清空所有日志</button>
        </div>
        <table class="layui-table">
            <tbody>
            <tr>
                <th>事件</th>
                <th>结果</th>
                <th>IP</th>
                <th>时间</th>
            </tr>
                <#list logs as log>
                    <tr>
                        <td>${log.getLogTitle()}</td>
                        <td>${log.getLogContent()}</td>
                        <td>${log.getLogIp()}</td>
                        <td>${log.getCreateTime()?string('yyyy-MM-dd HH:mm:ss')}</td>
                    </tr>
                </#list>
            </tbody>
        </table>
    </div>
    <!-- 分页 -->
    <div class="layui-box layui-laypage layui-laypage-default">
        <#if !pageInfo.isFirstPage>
                <a href="/admin/logs/showLogs?pageNum=${pageInfo.firstPage}&pageSize=${pageInfo.pageSize}<#if startTime??>&startTime=${startTime}</#if><#if endTime??>&endTime=${endTime}</#if>"
                   class="layui-laypage-next">首页</a>
        <#elseif pageInfo.isFirstPage>
            <a class="layui-laypage-next layui-disabled">首页</a>
        </#if>
        <#if pageInfo.hasPreviousPage>
            <a href="/admin/logs/showLogs?pageNum=${pageInfo.prePage}&pageSize=${pageInfo.pageSize}<#if startTime??>&startTime=${startTime}</#if><#if endTime??>&endTime=${endTime}</#if>"
               class="layui-laypage-prev ">上一页</a>
        <#elseif !pageInfo.hasPreviousPage>
            <a class="layui-laypage-prev layui-disabled">上一页</a>
        </#if>

         <#list pageInfo.navigatepageNums as nav>
             <#if nav == pageInfo.pageNum>
                 <span class="layui-laypage-curr"><em class="layui-laypage-em"></em><em>${nav}</em></span>
             </#if>
             <#if nav != pageInfo.pageNum>
                 <a href="/admin/logs/showLogs?pageNum=${nav}&pageSize=${pageInfo.pageSize}<#if startTime??>&startTime=${startTime}</#if><#if endTime??>&endTime=${endTime}</#if>">${nav}</a>
             </#if>
         </#list>
        <#if pageInfo.hasNextPage>
            <a href="/admin/logs/showLogs?pageNum=${pageInfo.nextPage}&pageSize=${pageInfo.pageSize}<#if startTime??>&startTime=${startTime}</#if><#if endTime??>&endTime=${endTime}</#if>"
               class="layui-laypage-next">下一页</a>
        </#if>
        <#if !pageInfo.hasNextPage>
            <a class="layui-laypage-next layui-disabled">下一页</a>
        </#if>
        <#if !pageInfo.isLastPage>
            <a href="/admin/logs/showLogs?pageNum=${pageInfo.lastPage}&pageSize=${pageInfo.pageSize}<#if startTime??>&startTime=${startTime}</#if><#if endTime??>&endTime=${endTime}</#if>"
               class="layui-laypage-next">尾页</a>
        </#if>
        <#if pageInfo.isLastPage>
            <a class="layui-laypage-next layui-disabled">尾页</a>
        </#if>
    </div>
</div>
<script type="text/javascript" src="/static/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="/static/js/jquery/jquery-3.3.1.min.js"></script>
<script tabindex="text/javascript">
    function removeLogs() {
        layui.use('layer', function () {
            var layer = layui.layer;
            layer.confirm('是否清空所有日志？', {icon: 3, title: '提示'}, function () {
                window.location.href = "/admin/logs/removeAllLog";
            });
        });
    }
    layui.use('laydate', function () {
        var laydate = layui.laydate;
    var startTime = <#if startTime??>'${startTime}'<#else>''</#if>;
    var endTime = <#if endTime??>'${endTime}'<#else>''</#if>;

        //执行一个laydate实例
        laydate.render({
            elem: '#start', //指定元素
            type: 'datetime',
            value: startTime
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end', //指定元素
            type: 'datetime',
            value: endTime
        });
    });
</script>
</body>
</html>